benchmark_sources = ['benchmark.cpp', 'no_op.cpp']

if get_option('use_protobuf')
  message('Enable PROTOBUF')

  protoc = find_program('protoc', required : false)
  protobuf_dep = dependency('protobuf', required : false)
  
  if not protoc.found() or not protobuf_dep.found()
    error('MESON_SKIP_TEST: protoc tool and/or protobuf pkg-config dependency not found')
  endif
  
  gen = generator(protoc, \
    output    : ['@BASENAME@.pb.cc', '@BASENAME@.pb.h'],
    arguments : ['--proto_path=@CURRENT_SOURCE_DIR@', '--cpp_out=@BUILD_DIR@', '@INPUT@'])
  
  generated = gen.process('data_def.proto')

  benchmark_sources += generated
  compile_args += '-DHAVE_PROTOBUF'
  dependencies += protobuf_dep
endif

if get_option('use_boost_serialization')
  message('Enable Boost Serialization')
  boost_dep = dependency('boost', modules: ['serialization'])

  compile_args += '-DHAVE_BOOST_SERIALIZATION'
  dependencies += boost_dep
endif


executable('benchmark_serialize',
  benchmark_sources,
  include_directories: includes,
  cpp_args: compile_args,
  dependencies: dependencies)
